package com.xls.box2023.network;

import com.xls.box2023.entity.WXEntity;
import com.lzz.bottomencapsulation.entity.VersionEntity;
import com.lzz.bottomencapsulation.net.HttpRequest;
import com.xls.box2023.entity.AccountBalanceEntity;
import com.xls.box2023.entity.AppTeamUsersEntity;
import com.xls.box2023.entity.AppsRulesEntity;
import com.xls.box2023.entity.DuiHuanJiBiInfoEntity;
import com.xls.box2023.entity.JiFenDuiHuanJiLuEntity;
import com.xls.box2023.entity.JiFenMingXiEntity;
import com.xls.box2023.entity.JiFenTiXianBiliEntity;
import com.xls.box2023.entity.PageEntity;
import com.xls.box2023.entity.TiXianJiLuEntity;
import com.xls.box2023.entity.UserEntity;
import com.xls.box2023.entity.WXUserInfoEntity;
import com.xls.box2023.entity.YouXiEntity;
import com.xls.box2023.entity.YouXiXiaoHaoJinBiEntity;

import java.util.ArrayList;
import java.util.Map;

import io.reactivex.rxjava3.core.Observable;
import retrofit2.http.Body;
import retrofit2.http.Field;
import retrofit2.http.FieldMap;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Headers;
import retrofit2.http.POST;
import retrofit2.http.Query;

public interface IApiserver {
    @GET("access_token?")
    Observable<WXEntity> getAccessToken(@Query("appid") String appid, @Query("secret") String secret, @Query("code") String code, @Query("grant_type") String grant_type);

    @GET("userinfo?")
    Observable<WXUserInfoEntity> getWXUserInfo(@Query("access_token")String token, @Query("openid") String openID, @Query("lang") String zhCn);

    @FormUrlEncoded
    @POST("/api/user/login")
    Observable<HttpRequest<String>> getLogin(@FieldMap Map<String, String> map);

    @Headers({"Content-Type: application/json","Accept: application/json"})
    @POST("/api/user/reg")
    Observable<HttpRequest<String>> userReg(@Body String data);

    @POST("/api/user/getMyBalance")
    Observable<HttpRequest<AccountBalanceEntity>> getAccountBalance();


    @FormUrlEncoded
    @POST("/api/user/mg/business")
    Observable<HttpRequest<String>> getUserCode(@Field("apkName") String apkName,@Field("userCode") String userCode,@Field("keyStore") String keyStore);

    @FormUrlEncoded
    @POST("/api/user/mg/businessMD5")
    Observable<HttpRequest<YouXiEntity>> getUserCode2(@Field("apkName") String apkName,@Field("userCode") String userCode,@Field("keyStore") String keyStore);



    @POST("/api/user/getUserCode")
    Observable<HttpRequest<UserEntity>> getUserCode();

    @POST("/api/apps/getBoxApps")
    Observable<HttpRequest<ArrayList<YouXiEntity>>> getMyApps();
    @POST("/api/user/getUserInfo")
    Observable<HttpRequest<UserEntity>> getUserInfo();
    @FormUrlEncoded
    @POST("/api/apps/downLoadApp")
    Observable<HttpRequest<String>> getAPKURL(@Field("appId") String appId);
    @FormUrlEncoded
    @POST("/api/apps/getMyDownLoadAppRecords")
    Observable<HttpRequest<PageEntity<YouXiXiaoHaoJinBiEntity>>> getMyDownLoadAppRecords(@Field("pageSize")int pageSize, @Field("pageNum") int pageNum);

    /**
     * * 获取积分兑换金币得明细
     * @param pageSize
     * @param pageNum
     * @param appId
     * @return
     */
    @FormUrlEncoded
    @POST("/api/score/getMyScoreExchangeRecords")
    Observable<HttpRequest<PageEntity<JiFenDuiHuanJiLuEntity>>> getMyScoreExchangeRecords(@Field("pageSize")int pageSize, @Field("pageNum") int pageNum, @Field("appId") String appId,@Field("typeId")String typeId);
    @FormUrlEncoded
    @POST("/api/coins/getMyCoinsExchangeRecords")
    Observable<HttpRequest<PageEntity<TiXianJiLuEntity>>>  getMyCoinsExchangeRecords(@Field("pageSize")int pageSize, @Field("pageNum") int pageNum);
    @FormUrlEncoded
    @POST("/api/coins/coinsExchange2")
    Observable<HttpRequest<String>>  coinsExchange(@Field("coins")String numStr,
                                                   @Field("unionId")String unionId,
                                                   @Field("openId")String openId,
                                                   @Field("headImageUrl")String headImageUrl,
                                                   @Field("nickname")String nickname,
                                                   @Field("packageName")String packageName,
                                                   @Field("fromBox")String fromBox);

    @FormUrlEncoded
    @POST("/api/apps/getMyAppsAccount")
    Observable<HttpRequest<ArrayList<JiFenMingXiEntity>>> getMyAppsAccount(@Field("headImageUrl")String headImageUrl,
                                                                           @Field("nickname")String nickname,
                                                                           @Field("packageName")String packageName);
    @FormUrlEncoded
    @POST("/api/apps/getAppRules")
    Observable<HttpRequest<ArrayList<AppsRulesEntity>>> getAppRules(@Field("appId")String appId,@Field("packageName")String packageName,@Field("scoreRuleType")String type);
    @FormUrlEncoded
    @POST("/api/score/scoreExchange2")
    Observable<HttpRequest<DuiHuanJiBiInfoEntity>> getScoreExchange(@Field("rulesId")String rulesId,
                                                                    @Field("typeId")String typeId,
                                                                    @Field("appId")String appId,
                                                                    @Field("packageName")String packageName,
                                                                    @Field("unionId")String unionId,
                                                                    @Field("openId")String openId,
                                                                    @Field("headImageUrl")String headImageUrl,
                                                                    @Field("nickname")String nickname,
                                                                    @Field("fromBox")String fromBox);
    @FormUrlEncoded
    @POST("/api/apps/checkUpdate")
    Observable<HttpRequest<VersionEntity>> checkUpdate(@Field("packageName")String packageName);

    @FormUrlEncoded
    @POST("/api/user/getUserLevel")
    Observable<HttpRequest<UserEntity>>  getUserLevel(@Field("appId")String appId ,@Field("packageName")String packageName);

    @FormUrlEncoded
    @POST("/api/score/getScoreExchangeRateRules")
    Observable<HttpRequest<ArrayList<JiFenTiXianBiliEntity>>> getScoreExchangeRateRules(@Field("appId")String appId , @Field("packageName")String packageName);

    @FormUrlEncoded
    @POST("/api/apps/getAccountByAppId")
    Observable<HttpRequest<JiFenMingXiEntity>> getAccountByAppId(@Field("appId")String appId, @Field("packageName")String packageName);


    @FormUrlEncoded
    @POST("/api/user/getAppTeamUsersNew")
    Observable<HttpRequest<AppTeamUsersEntity>> getAppTeamUsers(@Field("appId")String appId, @Field("packageName")String packageName,@Field("startDate")String startDate,@Field("endDate")String endDate);

    @FormUrlEncoded
    @POST("/api/user/getTeamUsersNew")
    Observable<HttpRequest<AppTeamUsersEntity>> getTeamUsers(@Field("startDate")String startDate,@Field("endDate")String endDate);

    @FormUrlEncoded
    @POST("/api/user/fkCheck")
    Observable<HttpRequest<String>> fkCheck(@FieldMap Map<String, String>  str);
    @POST("/api/user/getAppShareButtion")
    Observable<HttpRequest<UserEntity>> getAppShareButtion();

    @POST("/api/user/getUserAgentInfo")
    Observable<HttpRequest<UserEntity>> getUserAgentInfo();
}
